#[derive(Debug)]
pub enum Coin {
    Penny,
    Nickel,
    Dime,
    Quarter,
}

pub fn match_coin(coin: Coin) {
    match coin {
        Coin::Penny => {
            println!("The coin is Penny!");
        }
        _ => {
            println!("The coin is Other!");
        }
    }
}

pub fn match_number() {
    let nums = (1, 2, 4, 6);
    match nums {
        (first, .., last) => {
            println!("The number of first is {},last is {}", first, last);
        }
    }
}

pub fn match_some() {
    let x = Some(11);
    let y = 10;
    match x {
        Some(11) => println!("12312312"),
        Some(n) if n == y => println!("abcd"),
        _ => println!("Other value"),
    }
}

enum Message {
    Hello { id: u32 },
}

pub fn match_biding() {
    let msg = Message::Hello { id: 100 };
    match msg {
        Message::Hello { id: id_variable @ 10..=20 } => {
            println!("The value is {}", id_variable);
        }
        Message::Hello { id: id_variable @ 21..=30 } => {
            println!("The value is {}", id_variable);
        }
        Message::Hello { id: 1..=7 } => {
            println!("1231");
        }
        Message::Hello { id: _ } => {
            println!("1312312fsd");
        }
    }
}